from django.conf.urls.defaults import *
from django.contrib import admin
from django.contrib.auth.views import login
from django.contrib.auth.views import logout
from django.contrib.auth.views import password_reset
from django.contrib.auth.views import password_reset_done
from django.contrib.auth.views import password_reset_confirm
from django.contrib.auth.views import password_reset_complete
from django.contrib.auth.views import password_change
from django.contrib.auth.views import password_change_done

from psd.register.views import sign_up_indiv, sign_up_group, registration_note
from psd.register.views.dashboard import check_in, event_manager, potential_matches, date_sheet, break_matches
from psd.register.views.printouts import make_schedules
from psd.register.views.users import show_me, show_me_all
from psd.register.views import PaypalPaymentEndpoint

#from psd.register.views.users import current_datetime
#from psd.playpen.views import current_datetime

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
#    ('^.*','django.views.generic.simple.direct_to_template', {'template': 'maintenance.html'})
    ('^regnote/(?P<event_name>[0-9A-Za-z]+)$', registration_note ),
    ('^regnote/$',  registration_note ),
    ('^accounts/login/$', login),
#    ('^accounts/login/$', login_user),
    ('^accounts/logout/$', logout),
    ('^schedules/(?P<event_name>[0-9A-Za-z]+)', make_schedules),
#    ('^schedules', make_schedules),

    ('^reset/$', password_reset, {'email_template_name':'registration/password_reset_email.html'}),
    ('^reset/done/$', password_reset_done),
    ('^reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', password_reset_confirm), #{'post_reset_redirect':'/reset/complete/'}),
    (r'^reset/complete/$', password_reset_complete),

    url(r'^endpoint/$', PaypalPaymentEndpoint(), name="paypal-endpoint"),

    ('^accounts/changepw/$', password_change),
    ('^accounts/changepw/done$', password_change_done),
    url('^accounts/view/$', show_me_all, name="account-view"),
#    ('^accounts/view/(?P<event_name>[0-9A-Za-z]+)$', show_me),
    ('^admin/checkin/(?P<event_name>[0-9A-Za-z]+)$', check_in),
    ('^admin/manage/(?P<event_name>[0-9A-Za-z]+)/(?P<action>[a-z]*)$', event_manager),
    ('^admin/matches/(?P<event_name>[0-9A-Za-z]+)/(?P<psdid>[0-9A-Za-z]+)$', potential_matches),
    ('^datesheet/(?P<event_name>[0-9A-Za-z]+)/(?P<psdid>[0-9A-Za-z]+)$', date_sheet),
    ('^admin/break/(?P<event_name>[0-9A-Za-z]+)/(?P<psdid>[0-9A-Za-z]+)$', break_matches),
#    ('^admin/manage/(?P<event_name>[0-9A-Za-z]+)$', event_manager),
    
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^admin/(.*)', admin.site.root),

    ('^individual$', 'django.views.generic.simple.direct_to_template', {'template': 'no_event_specified.html'}),
    ('^group$', 'django.views.generic.simple.direct_to_template', {'template': 'no_event_specified.html'}),

    ('^individual/(?P<event_name>[0-9A-Za-z]+)$', sign_up_indiv),
    ('^group/(?P<event_name>[0-9A-Za-z]+)$', sign_up_group),


#    (r'^now/$', current_datetime )
)
